<template>
  <div class="p-1 d-scroll listInner historicalOpinions">
    <div v-if="dataList.length > 0" class="common_list">
      <div v-for="item in dataList" :key="item.id" class="list_item" @click="goToDetails(item)">
        <div class="content_area">
          <div class="number_order">1</div>
          <div class="right_content">
            <div class="content_title" style="max-width: 100%" />
            <ul>
              <li v-for="(field, ind) in tabListColumn" :key="field.fieldName">
                <i :class="'iconfont c-text-color' + ((ind % 7) + 1)" v-html="field.icon" />
                <div class="label"> {{ field.label }} </div>
                <div class="value">{{ field.value }}</div>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>
    <van-empty
      v-else
      class="custom-image"
      image="https://img01.yzcdn.cn/vant/custom-empty-image.png"
      description="暂无数据"
    />
  </div>
</template>
<script>
import { selectAllOptions } from '@/api/special'

export default {
  id: 'historicalOpinions',
  inject: ['layout'],
  props: {
    /**
     * 任务ID
     */
    taskId: {
      type: String,
      default: () => ''
    }
  },
  data() {
    return {
      tabListColumn: [
        { label: '核查地区：', fieldName: 'hcdq', value: '/', icon: '&#xe6bb;' },
        { label: '单位名称：', fieldName: 'wrymc', value: '/', icon: '&#xe6bb;' },
        { label: '问题类型：', fieldName: 'wtlx', value: '/', icon: '&#xe6bb;' },
        { label: '核查意见：', fieldName: 'auditOption', value: '/', icon: '&#xe6bb;' },
        { label: '添加账号：', fieldName: 'auditUserid', value: '/', icon: '&#xe6bb;' },
        { label: '添加时间：', fieldName: 'auditTime', value: '/', icon: '&#xe6bb;' },
        { label: '更新时间：', fieldName: 'modifyTime', value: '/', icon: '&#xe6bb;' }
      ],
      dataList: []
    }
  },
  methods: {
    async getHistoryOptionsHandler() {
      try {
        this.layout.showAreaLoading(['.historicalOpinions'])
        const { status, data } = await selectAllOptions({ taskid: this.taskId })
        if (status === 0 && data) {
          this.tabListColumn.forEach(item => {
            item.value = data[item.fieldName]
          })
          this.dataList = data
        }
        setTimeout(() => { this.layout.hideAreaLoading(['.historicalOpinions']) }, 300)
      } catch (err) {
        console.log(err)
      }
    },
    goToDetails() {

    }
  }
}
</script>
<style lang="scss" scoped>
.historicalOpinions {
  background-color: #eef1f3;
}
</style>
